package database;

import java.util.List;

import mockup.Mockup;

/**
 * Objects that inserts, updates, deletes, 
 * ang gets from the database should implements
 * this interface to get a consistency of methods and 
 * actions available to the database
 * @author daniel
 *
 */
public interface DatabaseAction {
	
	/**
	 * Inserts the object to the database if the ID is less than zero
	 * @param m the object to save
	 * @return the integer given in the table
	 */
	public int insert(Mockup m);
	
	/**
	 * Updates an object if the ID is greater than zero. The
	 * updates is based on the id, and updates every field.
	 * @param m the object to be updated
	 */
	public void update(Mockup m);
	
	/**
	 * Deletes the object from the database. This is
	 * based only on the id field.
	 * @param m the object (object id) to be deleted
	 */
	public void delete(Mockup m);
	
	/**
	 * Gets an object from the database based
	 * om the given id
	 * @param id The id to the object in the table
	 * @return the object found from that id. "NULL" if none.
	 */
	public Mockup get(int id);
	
	/**
	 * Gets all the objects in a table
	 * @return a list of objects found in the tables
	 */
	public List<? extends Mockup> getAll();
	
	/**
	 * Emptyes the whole table.
	 * Be careful!!
	 */
	public void emptyTable();
}
